<?php



namespace App\Listeners\SyncedAccountEvent;


use App\Events\SyncedAccountEvent;
use App\Services\Member\Services\UserService;
use App\Services\Member\Interfaces\UserServiceInterface;

class SyncedAccountListener
{

    /**
     * @var UserService
     */
    protected $userService;

    /**
     * SyncedAccountListener constructor.
     * @param UserServiceInterface $userService
     */
    public function __construct(UserServiceInterface $userService)
    {
        $this->userService = $userService;
    }

    /**
     * Handle the event.
     *
     * @param SyncedAccountEvent $event
     * @return void
     */
    public function handle(SyncedAccountEvent $event)
    {
          $this->userService->updateNicknameAndAvatar($event->userId,$event->nickname,$event->avatar);
    }
}
